<%@ page import="org.internna.iwebjtracker.spring.mvc.ProjectController" %>
<%@ taglib prefix="iwebmvc" uri="http://tags.iwebmvc.com" %>
<%@ taglib prefix="iwebjtracker" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c-rt:set var="project" value="<%= ProjectController.PROJECT %>" />
<c-rt:set var="issueFilters" value="<%= ProjectController.ISSUE_FILTERS %>" />
<c-rt:set var="activityFilters" value="<%= ProjectController.ACTIVITY_FILTERS %>" />
<c-rt:set var="predefinedQueries" value="<%= ProjectController.PREDEFINED_QUERIES %>" />
<c-rt:set var="activityClass" value="<%= org.internna.iwebjtracker.model.Activity.class %>" />
<c-rt:set var="issueClass" value="<%= org.internna.iwebjtracker.model.DefaultIssue.class %>" />
<c-rt:set var="sessionUser" value="<%= org.internna.iwebmvc.security.UserManager.SESSION_USER %>" />
<c:if test="${requestScope[project].closed}">
    <div style="background-color:#CCCC99;height:25px;width:99%;text-align:center;font-weight:bold;padding-top:7px;margin-bottom:5px;font-size:16px"><iwebmvc:message argMessage="ui.project.closed" /></div>
</c:if>
<iwebmvc:panel title="ui.project.issuesFor;${requestScope[project].projectName}" width="99%;margin:0">
    <iwebmvc:filteredgrid id="${requestScope[project].alias}Issues" entityClass="${issueClass}" currentDepthLevel="0" baseColumnWidth="100" pages="5" rows="11" selectionMode="single" filters="${requestScope[issueFilters]}" queries="${requestScope[predefinedQueries]}">
        <div class="overclear" style="vertical-align:top">
            <div class="float_left" style="padding-top:5px;margin-left:15px">
                <iwebmvc:sprite id="${requestScope[project].alias}IssuesFilter" text="iwebmvc.ui.crud.filter;${issueClass.name}" sprite="table_${sessionScope[sessionUser].theme}.png" top="-250px" position="after">
                    showIssuesFilter("${requestScope[project].alias}", true);
                </iwebmvc:sprite>
                <iwebmvc:sprite id="${requestScope[project].alias}IssuesHide" text="iwebmvc.ui.crud.hide;${issueClass.name}" sprite="table_${sessionScope[sessionUser].theme}.png" top="-300px" style="display:none" position="after">
                    hideIssuesFilter("${requestScope[project].alias}", true);
                </iwebmvc:sprite>
                <iwebmvc:hide requiredRoles="ROLE_ISSUE_CREATOR">
                    <iwebmvc:sprite id="${requestScope[project].alias}IssuesAdd" text="iwebmvc.ui.crud.add;${issueClass.name}" sprite="table_${sessionScope[sessionUser].theme}.png" top="-50px" position="after">
                        refreshNewIssueLocatorStores("${requestScope[project].alias}", "<iwebmvc:value entity="${requestScope[project]}" path="id" encrypt="true" />");
                        openPopup("newissueform");
                    </iwebmvc:sprite>
                </iwebmvc:hide>
            </div>
            <div class="float_right" style="padding-top:6px;padding-right:15px">
                <iwebmvc:sprite id="${requestScope[project].alias}OpenIssue" text="ui.issue.open" sprite="table_${sessionScope[sessionUser].theme}.png" top="-150px" position="before" style="opacity:0.4">
                    var selection = dijit.byId("grid${requestScope[project].alias}Issues").selection;
                    if ((selection.selectedIndex >= 0) && (selection.getSelected()[0] != null)) openIssueTab(selection);
                </iwebmvc:sprite>
            </div>
        </div>
    </iwebmvc:filteredgrid>
</iwebmvc:panel>
<div class="panelSeparator"></div>
<iwebmvc:panel title="ui.project.activityFor;${requestScope[project].projectName}" width="99%;margin:0">
    <iwebmvc:filteredgrid id="${requestScope[project].alias}ProjectActivity" entityClass="${activityClass}" currentDepthLevel="0" baseColumnWidth="100" pages="5" rows="11" filters="${requestScope[activityFilters]}" hideFiltersOnLoad="true" defaultSort="{attribute: 'eventDate', descending: true}">
        <div class="overclear" style="vertical-align:top">
            <div class="float_left" style="padding-top:5px;margin-left:15px">
                <iwebmvc:sprite id="${requestScope[project].alias}ProjectActivityFilter" text="iwebmvc.ui.crud.filter;${activityClass.name}" sprite="table_${sessionScope[sessionUser].theme}.png" top="-250px" position="after">
                    showIssuesFilter("${requestScope[project].alias}", false);
                    dojo.query("#filterGroup${requestScope[project].alias}ProjectActivity .iconActionContainer").forEach(function(item, index, array) {
                        if (index == 1) dojo.style(item, "opacity", "0.5");
                    });
                </iwebmvc:sprite>
                <iwebmvc:sprite id="${requestScope[project].alias}ProjectActivityHide" text="iwebmvc.ui.crud.hide;${activityClass.name}" sprite="table_${sessionScope[sessionUser].theme}.png" top="-300px" style="display:none" position="after">
                    hideIssuesFilter("${requestScope[project].alias}", false);
                </iwebmvc:sprite>
            </div>
        </div>
    </iwebmvc:filteredgrid>
</iwebmvc:panel>
<script type="text/javascript">
    dojo.addOnLoad(function (){
        projectOnLoad("${requestScope[project].alias}");
    });
</script>